296eadcb35ca381bc200fb79cb94e1a2380e1d0a,server/src/main/java/com/orientechnologies/orient/server/plugin/mail/OMailPlugin.java,OMailPlugin,send,#Map#,100

Before Change


    }
    String bcc = (String) iMessage.get("bcc");
    if (bcc != null && !bcc.isEmpty()) {
      InternetAddress[] bccAddresses = { new InternetAddress(bcc) };
      msg.setRecipients(Message.RecipientType.BCC, bccAddresses);
    }
    msg.setSubject((String) iMessage.get("subject"));

After Change


   * @throws ParseException
   */
  public void send(final Map<String, Object> iMessage) throws AddressException, MessagingException, ParseException {
    if (iMessage == null)
      throw new IllegalArgumentException("Configuration is null");

    final String profileName = (String) iMessage.get("profile");

    final OMailProfile profile = profiles.get(profileName);
    if (profile == null)
      throw new IllegalArgumentException("Mail profile '" + profileName + "' is not configured on server");

    // creates a new session with an authenticator
    Authenticator auth = new OSMTPAuthenticator((String) profile.getProperty("mail.smtp.user"),
        (String) profile.getProperty("mail.smtp.password"));
    final Session session = Session.getInstance(profile, auth);

    // creates a new e-mail message
    MimeMessage msg = new MimeMessage(session);

    final String from;
    if (iMessage.containsKey("from"))
      // GET THE 'FROM' FROM THE MESSAGE
      from = (String) iMessage.get("from");
    else
      // GET THE 'FROM' FROM PROFILE
      from = (String) profile.getProperty("mail.from");

    if (from != null)
      msg.setFrom(new InternetAddress(from));

    final String to = (String) iMessage.get("to");
    if (to != null && !to.isEmpty())
      msg.setRecipients(Message.RecipientType.TO, getEmails(to));

    final String cc = (String) iMessage.get("cc");
    if (cc != null && !cc.isEmpty())
      msg.setRecipients(Message.RecipientType.CC, getEmails(cc));

    final String bcc = (String) iMessage.get("bcc");
    if (bcc != null && !bcc.isEmpty())
      msg.setRecipients(Message.RecipientType.BCC, getEmails(bcc));

    msg.setSubject((String) iMessage.get("subject"));